<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>To-Do lists</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        {% load static %}
        <link type="text/css" href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <link type="text/css" href="/static/base.css" rel="stylesheet">
        <script src="/static/tests/jquery-1.10.2.min.js"></script>
        <script src="/static/accounts.js"></script>
        <script src="/static/tests/list.js"></script>
        <script>
            $(document).ready(function() (
				window.Superlists.initialize();
            });
        </script>
    </head>
    <body>
        <div class="container">
            <nav class="navbar navbar-default" role="navigation">
                <div class="container-fluid">
                    <a class="navbar-brand" href="/">Superlists</a>
                    {% if user.email %}
                        <ul class="nav navbar-nav navbar-left">
                            <li><a href="{% url 'my_lists' user.email %}">My Lists</a></li>
                        </ul>
                        <ul class="nav navbar-nav navbar-right">
                            <li class="navbar-text navbar-right">Logged in as {{ user.email }}</li>
                            <li><a class="btn navbar-btn navbar-right" id="id_logout" href="{% url 'logout' %}">Logout</a></li>
                        </ul>
                    {% else %}
			            <form class="navbar-form navbar-right"
			                  method="POST"
			                  action="{% url 'send_login_email' %}">
			              <span>Enter email to log in:</span>
			              <input class="form-control" name="email" type="text" />
			              {% csrf_token %}
			            </form>
                    {% endif %}
                </div>
            </nav>
            <div class="row">
                <div class="col-md-6 col-md-offset-3 jumbotron">
                    <div class="text-center">
                        <h1>{% block header_text %}{% endblock %}</h1>
                        {% block list_form %}
                        <form id="id_item_form" method="POST" action="{% block form_action %}{% endblock %}">
                            {{ form.text }}
                            {% csrf_token %}
                            {% if form.errors %}
                                <div class="form-group has-error">
                                    <div class="help-block">{{ form.text.errors }}</div>
                                </div>
                            {% endif %}
                        </form>
                        {% endblock %}
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6 col-md-offset-3">
                    {% block table %}
                    {% endblock %}
                </div>
            </div>
            <div class="row">
                <div class="col-md-6 col-md-offset-3">
                    {% block extra_content %}
                    {% endblock %}
                </div>
            </div>
        </div>
    </body>
</html>